﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EECMISWS.WebProcessArgs
{
    public class ServiceReturnCode
    {
        private static Dictionary<string, string> _dicCodeImplication = new Dictionary<string,string>();

        public ServiceReturnCode()
        {
            if (_dicCodeImplication.Count > 0)
            {
                return;
            }
            _dicCodeImplication.Add("CRJ0000", "处理成功");
            _dicCodeImplication.Add("CRJ1001", "用户名/密码错误");
            _dicCodeImplication.Add("CRJ1002", "会话已失效，请重新登录");
            _dicCodeImplication.Add("CRJ1003", "用户权限不够，不能执行此操作");
            _dicCodeImplication.Add("CRJ1004", "功能代码无效");
            _dicCodeImplication.Add("CRJ1005", "校验码无效或已过时");
            _dicCodeImplication.Add("CRJ1006", "时段限制");
            _dicCodeImplication.Add("CRJ1101", "未知错误");
            _dicCodeImplication.Add("CRJ1102", "不支持");
            _dicCodeImplication.Add("CRJ1103", "操作失败");
            _dicCodeImplication.Add("CRJ1104", "条件不满足");
            _dicCodeImplication.Add("CRJ1105", "返回说明解析失败");
            _dicCodeImplication.Add("CRJ1106", "JSON解析失败");
            _dicCodeImplication.Add("CRJ1201", "参数错误");
            _dicCodeImplication.Add("CRJ1202", "参数为空");
            _dicCodeImplication.Add("CRJ1203", "参数重复");
            _dicCodeImplication.Add("CRJ1204", "参数超过范围");
            _dicCodeImplication.Add("CRJ1205", "参数格式错误");
            _dicCodeImplication.Add("CRJ1301", "值错误");
            _dicCodeImplication.Add("CRJ1302", "值为空");
            _dicCodeImplication.Add("CRJ1303", "值重复");
            _dicCodeImplication.Add("CRJ1304", "值超过范围");
            _dicCodeImplication.Add("CRJ1305", "值格式错误");
            _dicCodeImplication.Add("CRJ1401", "数据库错误");
            _dicCodeImplication.Add("CRJ1402", "数据库连接失败");
            _dicCodeImplication.Add("CRJ1403", "调用存储过程失败");
            _dicCodeImplication.Add("CRJ1404", "数据库查询失败");
            _dicCodeImplication.Add("CRJ1405", "数据库入库失败");
            _dicCodeImplication.Add("CRJ1406", "数据库更新失败");
            _dicCodeImplication.Add("CRJ1407", "数据库删除失败");
            _dicCodeImplication.Add("CRJ1501", "WebService 错误");
            _dicCodeImplication.Add("CRJ1502", "WebService 连接失败");
            _dicCodeImplication.Add("CRJ1503", "WebService 方法调用失败");
            _dicCodeImplication.Add("CRJ2101", "找不到数据");
            _dicCodeImplication.Add("CRJ2102", "用户信息不存在");
            _dicCodeImplication.Add("CRJ2103", "人员信息不存在");
            _dicCodeImplication.Add("CRJ2104", "申请信息不存在");
            _dicCodeImplication.Add("CRJ2105", "证件信息不存在");
            _dicCodeImplication.Add("CRJ2106", "居留许可不存在");
            _dicCodeImplication.Add("CRJ2107", "单位不存在");
        }

        //代码含义索引器
        public string this[string name]
        {
            get
            {
                if (_dicCodeImplication.ContainsKey(name))
                {
                    return _dicCodeImplication[name];
                }
                return "未知代码";
            }
        }
    }
}
